//package com.plian.system.service.yth.impl;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.plian.Tools.CollectionUtil;
//import com.plian.system.constant.sys.FormTypeConstant;
//import com.plian.system.entity.yth.meet.ConferenceDecisionExecuteBase;
//import com.plian.system.mapper.yth.meet.ConferenceDecisionExecuteBaseMapper;
//import com.plian.system.service.yth.IConferenceDecisionExecuteBaseService;
//import lombok.AllArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Service;
//
//import java.time.ZoneId;
//import java.util.*;
//
///**
// * @Description: TODO
// * @Author: Take-off
// * @Date: 2023/4/19 11:01 AM
// * @Param
// * @return
// * @Version: 1.0
// **/
//@Slf4j
//@Service
//@AllArgsConstructor
//public class ConferenceDecisionExecuteBaseServiceImpl extends ServiceImpl<ConferenceDecisionExecuteBaseMapper, ConferenceDecisionExecuteBase> implements IConferenceDecisionExecuteBaseService {
//
//    private final String YTH_DATASOURCE_TYPE = "3";
//
//    @Override
//    @DS("slave_1")
//    public List<TopicImplement> getAllProject(Date startTime, Date endTime){
//        List<TopicImplement> topicImplements = new ArrayList<>();
//
//        List<ConferenceDecisionExecuteBase> executeBases = list(new LambdaQueryWrapper<ConferenceDecisionExecuteBase>()
//                .gt(Optional.ofNullable(startTime).isPresent(), ConferenceDecisionExecuteBase::getCreateTime, startTime)
//                .le(Optional.ofNullable(endTime).isPresent(), ConferenceDecisionExecuteBase::getCreateTime, endTime)
//        );
//
//        if (CollectionUtil.isNotEmpty(executeBases)){
//            topicImplements = conversion(executeBases);
//        }
//        return topicImplements;
//    }
//
//    private List<TopicImplement> conversion(List<ConferenceDecisionExecuteBase> executeBases){
//        List<TopicImplement> topicImplements = new ArrayList<>();
//        ZoneId zone = ZoneId.systemDefault();
//        for (ConferenceDecisionExecuteBase executeBase:executeBases){
//            TopicImplement topicImplement = new TopicImplement();
//            topicImplement.setTopicId(Long.valueOf(executeBase.getTopicId()));
//            Optional.ofNullable(executeBase.getReportUserId()).ifPresent(m ->{
//                topicImplement.setReportUser(m.toString());
//            });
//
//            Optional.ofNullable(executeBase.getReportTime()).ifPresent(m ->{
//                topicImplement.setReportTime(Date.from(m.atStartOfDay().atZone(zone).toInstant()));
//            });
//
//            topicImplement.setFormType(String.valueOf(FormTypeConstant.PF_TRIPLE_TOPIC_IMPLEMENT));
//
//            topicImplement.setImplementReportStatus(executeBase.getExecuteStatus());
//            topicImplement.setResponsibilityUser(executeBase.getDutyUserName());
//            topicImplement.setResponsibilityDept(executeBase.getDutyDeptName());
//            Optional.ofNullable(executeBase.getActualCompletionTime()).ifPresent(m ->{
//                topicImplement.setTrueFinishTime(Date.from(m.atStartOfDay().atZone(zone).toInstant()));
//            });
//            topicImplement.setRemarks(executeBase.getRemark());
//            topicImplement.setDataSource(YTH_DATASOURCE_TYPE);
//            topicImplement.setDataSourceId(executeBase.getId().toString());
//
//            //todo
//            TopicImplementDetail topicImplementDetail = new TopicImplementDetail();
//            topicImplementDetail.setResponsibilityUser(executeBase.getDutyUserName());
//            topicImplementDetail.setResponsibilityDept(executeBase.getDutyDeptName());
//
//            Optional.ofNullable(executeBase.getPlanCompletionTime()).ifPresent(m ->{
//                topicImplementDetail.setFinishTime(Date.from(m.atStartOfDay().atZone(zone).toInstant()));
//            });
//            topicImplement.setImplementDetails(Arrays.asList(topicImplementDetail));
//
//            topicImplements.add(topicImplement);
//        }
//        return topicImplements;
//    }
//
//
//}
